<?php
$options = array(	//'metadata_name_value_pairs'	=>	array('product_type_id' => $product_type_id),

						
					);
					
    $options = array(
		'types'				=>	"object",
		'subtypes'			=>	"county",				
		'limit'				=>	999,
        "joins" => "INNER JOIN {$CONFIG->dbprefix}objects_entity o ON (o.guid = e.guid)",
        "order_by" => "o.title ASC",

    );
					
			
		$county_lists = elgg_get_entities($options);
		
        
        /**
         * prepare list of categories to dropdown menu
         */
        $options_values = array();
        if($county_lists){
        	foreach ($county_lists as $county_list){
        		$options_values[$county_list->title] = $county_list->title;
        		$county = get_entity($county_list->guid);
        		$county->access_id = 1;
        		$county->save();
        	}	
        }
        
        //print_r($options_values);	
        				
        $county_label = elgg_echo('county');
        
		/**
		 * creates element to display category drop down menu
		 */	        
        if(!empty($county_lists)){
			$county_view = elgg_view('input/pulldown', array('internalname' => 'county', 
													  'options_values' => $options_values, 'value' => $vars['value']));
        }else{
        	$county_view = elgg_echo('no:county');	
        }
        
        echo $county_view;